<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class HomeUserPhoneCaptchaLogin extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
     public function authorize()
     {
         return true;
     }

     public function rules()
     {
         return [
             'phone' => ['required', 'regex:/^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/u'],
             'code'  => 'required|min:6|max:6',
         ];
     }

     public function messages()
     {
         return [
             'code.required'  => '验证码不能为空',
             'code.max'       => '验证码不能超过6位',
             'code.min'       => '验证码不能小于6位',
             'phone.required' => '手机号码不能为空',
             'phone.regex'    => '手机号格式不正确',
         ];
     }
}
